package org.xilin

class Semester implements Serializable {
    Integer         year
    String          semester
    Date            startDate
    Date            endDate
    Date            regStartDate
    Date            regEndDate
    Date            earlyRegDiscountEndDate
    Date            lastDayToChangeClass
    Date            lastDayToReturnBook
    Float           regFee
    Float           lateRegFee
    Float           changeClassFee
    Float           returnBookFee
    Integer         podFee
    Integer         earlyRegDiscount
    String          active = 'Y'
    User            updatedBy
    Date            dateCreated, lastUpdated
    String          term
  
    //transient String term
    static transients = ['term']

    String getTerm() {
        toString()
    }

    static constraints = {
        year        (nullable:false, min:2010)
        semester    (nullable:false, inList:["Spring", "Summer", "Fall", "Winter"] )
        startDate   (nullable:true)
        endDate     (nullable:true)
        active      (inList:['Y','N'])
        updatedBy   (nullable:false)

        regStartDate            (nullable:true)
        regEndDate              (nullable:true)
        lastDayToChangeClass    (nullable:true)
        lastDayToReturnBook     (nullable:true)
        regFee                  (nullable:true)
        regStartDate            (nullable:true)
        lateRegFee              (nullable:true)
        changeClassFee          (nullable:true)
        returnBookFee           (nullable:true)
        podFee                  (nullable:true)
        earlyRegDiscountEndDate (nullable:true)
        earlyRegDiscount        (nullable:true)
    }

    String toString() {
        "${semester}, ${year as String}"
    }

}
